import pandas as pd
import numpy as np
import datetime


# start = datetime.datetime(2010,1,1)
# end = datetime.datetime.now()
# print(start)
# print(end)
#
# path = './Simplified_code/data/waveformscegun/cegun.csv'
# col = ['num','time','data']
# df = pd.read_csv(path,header=None,sep=',',names=col)
# print(df)
# print(df)
# print(df)
# print(df.head())

# 列表对象生成df
# df = pd.Series([1,2,3,2,3,4,23,44])
# print(df)

# 构造dataframe
# start = datetime.datetime(2019,6,21)
# end = datetime.datetime.now()
# dates = pd.date_range(start,periods=6)
# print(dates)
# df = pd.DataFrame(np.random.randn(6,4),index=dates,columns=list('ABCD'))
# print(df)

# 以上是构造数据，接下来查看数据
# print(df.index)
# print(df.columns)
# print(df.to_numpy())
# print(df.T)
# print(df)
# print(df.sort_values(by='B'))


# 选择数据
# print(df['B'].apply(lambda x : x.max() - x.min()))
# print(df.apply(lambda x : x.max() - x.min()))

path = './Simplified_code/data/waveformscegun/cegun.csv'
df = pd.read_csv(path,header=None)
# print(df.head())
data_series = df[2]
print(data_series)
# print(data_list)
data_list = list(data_series)
print(data_list[:5])
print(len(data_list))

print(round(df[1].max()-df[1].min(),5))
